package com.jy.modules.cims.component.sysAssist.BQRunner;

import java.util.concurrent.BlockingQueue;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 阻塞队列消费者
 * <b>类名称：</b>TaskBQConsumer <br/>
 * <b>类描述：</b><br/>
 * <b>创建人：</b>chenguixue<br/>
 * <b>修改人：</b><br/>
 * <b>修改时间：</b>2015-4-9 下午7:33:49<br/>
 * <b>修改备注：</b><br/>
 * <b>版本信息：</b>v1.0.0<br/>
 */
public class TaskBQConsumer implements Runnable {
	
	private static final Logger logger =  LoggerFactory.getLogger(TaskBQConsumer.class);
	
	private MultiTaskBQRunner multiTaskBQRunner;
	
	public TaskBQConsumer(MultiTaskBQRunner multiTaskBQRunner) {
        this.multiTaskBQRunner = multiTaskBQRunner;
    }
	
	public void run() {
		while(true) {
			logger.info("进入线程内。。。");
			try {
				multiTaskBQRunner.consume();
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				logger.error("执行任务失败", e.getStackTrace());
			} 
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		 
	}
}
